﻿//image error - "no photo"
    //general prod images
    $("img.prodImg").each(function () {
        var image = $(this);
        if (image.context.naturalWidth == 0 ||
        image.readyState == 'uninitialized') {
            $(image).unbind("error").attr(
                "src", "http://content.gjwtitmuss.co.uk/1/1/images/icons/no-image-300x300.gif"
            );
        }
    });

    //small prod images
    $('.prodImg .small, .prodImg.small, img.small').error(function () {
        $(this).attr('src', 'http://content.gjwtitmuss.co.uk/1/1/images/icons/no-image-70x70.gif');
    });
    $("img.prodImg.small, td img.prodImg").each(function () {
        var image = $(this);
        if (image.context.naturalWidth == 0 ||
        image.readyState == 'uninitialized') {
            $(image).unbind("error").attr(
                "src", "http://content.gjwtitmuss.co.uk/1/1/images/icons/no-image-70x70.gif"
            );
        }
    });

    //med prod images
    $('.prodImg .med,.prodImg.med, img.med').error(function () {
        $(this).attr('src', 'http://content.gjwtitmuss.co.uk/1/1/images/icons/no-image-150x150.gif');
    });
    $("img.prodImg.med").each(function () {
        var image = $(this);
        if (image.context.naturalWidth == 0 ||
        image.readyState == 'uninitialized') {
            $(image).unbind("error").attr(
                "src", "http://content.gjwtitmuss.co.uk/1/1/images/icons/no-image-150x150.gif"
            );
        }
    });

    //large prod images
    $('.prodImg .large, .prodImg.large, img.large').error(function () {
        $(this).attr('src', 'http://content.gjwtitmuss.co.uk/1/1/images/icons/no-image-300x300.gif');
    });
    $("img.prodImg.large").each(function () {
        var image = $(this);
        if (image.context.naturalWidth == 0 ||
        image.readyState == 'uninitialized') {
            $(image).unbind("error").attr(
                "src", "http://content.gjwtitmuss.co.uk/1/1/images/icons/no-image-300x300.gif"
            );
        }
    });

    //prod thumbnail images
    $("ul.gallery img").each(function () {
        var image = $(this);
        if (image.context.naturalWidth == 0 ||
        image.readyState == 'uninitialized') {
            $(image).unbind("error").attr(
                "src", "http://content.gjwtitmuss.co.uk/1/1/images/icons/no-image-50x50.gif"
            );
        }
    });
    
    //Category banner images
    var cat_img_null = true;
    $(".category_banner img").each(function () {
        if ($(this).attr("src") != "") {
            cat_img_null = false;
            return false; // break
        }
    });
    if (cat_img_null) {
        $(".category_banner").remove();
    }

